package com.hmall.item.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.dialects.IDialect;

public class MyPaginationInnerInterceptor extends PaginationInnerInterceptor {

    public MyPaginationInnerInterceptor(DbType dbType) {
        super(dbType);
    }

    public MyPaginationInnerInterceptor(IDialect dialect) {
        super(dialect);
    }

    @Override
    protected void handlerOverflow(IPage<?> page) {
        //设置页码为最后一页
        page.setCurrent(page.getPages());
    }
}
